package com.hua.springCloud.controller;


import com.hua.springCloud.entities.CommonResult;
import com.hua.springCloud.service.AccountServiceImpl;
import org.checkerframework.checker.units.qual.C;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigDecimal;

@RestController
public class AccountController{

    @Resource
   private AccountServiceImpl accountService;

    /**
     * 扣减账户余额
     */
    @RequestMapping("/account/reduce")
    CommonResult reduceMoney(@RequestParam("userId") Long userId, @RequestParam("money") BigDecimal money){
        accountService.reduceMoney(userId,money);
        return new CommonResult(200,"扣减账户余额成功！");
    }
}


